package javamobile.billsplit;

import java.util.ArrayList;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.*;
import android.view.View.*;
import android.widget.*;

public class ErrorActivity extends Activity{

	private Button confirm;
	private TextView msg;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.error);

        confirm = (Button) findViewById(R.id.confirm_ERROR);
        msg = (TextView) findViewById(R.id.errormsg_ERROR);
        Intent intent = getIntent();
        ArrayList<String> errorlist= intent.getStringArrayListExtra("errorlist");

        StringBuffer msg_SB = new StringBuffer();
        
        for (String s:errorlist) {
        	msg_SB.append(s);
        	msg_SB.append("\n");
        }
        msg.setText(msg_SB);
        confirm.setOnClickListener(new OnClickListener() {
        	@Override
        	public void onClick(View v) {
        		finish();
        	}
        });
    }
        


    @Override
    public boolean onOptionsItemSelected(MenuItem item) 
    {
       String menu_str = item.getTitle().toString();
       if (menu_str.equals("Home")) {
    	   Intent toHome = new Intent(ErrorActivity.this, HomeActivity.class);
    	   startActivity(toHome);
       }
       return super.onOptionsItemSelected(item); 
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true; 
    }
}
